<?php

$smarty->assign('scripts_dir', siteinfo('script'));
$smarty->assign('root_dir', siteinfo('root'));
$smarty->assign('styles_dir' , siteinfo('style'));
$smarty->assign('url' , siteinfo('url'));
$smarty->assign('userIsLogged', isUserLogged());
$smarty->assign('currentPage', $page);

$userIsAdmin = false;

if (isUserLogged()) {
    $loginUsername=$_SESSION['username'];
    setLastActivity($loginUsername);
    $user = getUserInfo($loginUsername);
    //Need to reduce info fields. User contains following fields:
    //id,username,password,Ime,datrodjenja,mesto,drzava,www,prikazivanje_maila,
    //email,nivopristupa,datum_registracije,pitanje,odgovor,fotografiseod,
    //interesovanja,osebi,slika,avatar,poslednji_pristup,status,rejting,mailnot,
    //premium,username,ime,mesto,slika,drzava,datum_registracije,id,rejting,
    //broj_fotografija,broj_pregleda,broj_skljoceva,broj_komentara
    $smarty->assign('user', $user);
    $userIsAdmin = checkIfUserIsAdmin($user);
    $smarty->assign('poruke', $context['user']['unread_messages']);
    $smarty->assign('porukeLink', $scripturl . '?action=pm');
}
$smarty->assign('loginbox', login_box(SITE_URL));
$smarty->assign('userIsAdmin', $userIsAdmin);


$smarty->assign('logoutLink', ssi_logout(SITE_URL, 'return'));
$smarty->display('header.tpl');

?>